package com.sgb.kjwl.view.ui.adapter.packers;

import android.content.Context;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.FindJobSearchEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.DateUtils;
import com.swgk.core.util.MDateUtil;

import java.util.List;

/**
*@author liwei
*@date 2020/10/13
*description:
*/
public class FindJobSearchAdapter extends BaseRecycleAdapter<FindJobSearchEntity> {

    public FindJobSearchAdapter(Context context, List<FindJobSearchEntity> data) {
        super(context, R.layout.item_find_job_search, data);
    }

    @Override
    public void convert(ItemViewHolder holder, FindJobSearchEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        TextView tvTime = holder.itemView.findViewById(R.id.tv_time);
        TextView tvEndDate = holder.itemView.findViewById(R.id.tv_end_time);
        TextView tvPublishTime = holder.itemView.findViewById(R.id.tv_publish_time);

        tvEndDate.setText(DateUtils.timestampToDate(entity.getEndDate()));
        tvTime.setText(MDateUtil.getStartAndEndDate1(entity.getStartTime(), entity.getEndTime()));
        tvPublishTime.setText(String.format("%s发布",DateUtils.timestampToDate(entity.getCreateTime())));
    }
}
